/**
 * Clase para probar algoritmos de SEL
 */
package project06.pmath;

import static java.lang.Math.random;
import static java.lang.System.*;
import java.io.*;
import java.util.Calendar;

/**
 * @author DAM
 *
 */
public class TestSEL {
	
	public static void generarCasos(String nombre, int n){
		try {
			PrintWriter fw = new PrintWriter(new FileWriter(nombre));
			fw.println(n);
			for(int i = 0; i < n; i++)
				for(int j = 0; j < n; j++){
					fw.println(i + " " + j + " " + ((random() * -9999) + 9999));
				}
			
			for(int i = 0; i < n; i++)
				fw.println(((random() * -999) + 999));
			
			fw.close();
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		SEL tested = new SEL();
		String linea;
		String path = "G:\\Proyectos\\java\\ProgrAvanzada\\test\\";
		String pack = "p_math\\";
		String in = "input\\";
		String sale = "output\\";
		//generarCasos(path + "input\\08_CASO_FATIGA_ORDEN_50.in", 50);
		
		try {
			BufferedReader br = new BufferedReader(new FileReader(new File(path + "p_math.txt")));
			
			try {
				while((linea = br.readLine()) != null){
					Calendar ini=Calendar.getInstance();
					tested.test(path + in + pack + linea + ".in", path + sale + pack + linea + ".out");
					Calendar fin=Calendar.getInstance();
					out.println(linea + " - Tiempo: " +(fin.getTimeInMillis() - ini.getTimeInMillis()));
					out.flush();
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
